#include "threadpool.hpp"
#include "task.hpp"
#include <time.h>
#include <unistd.h>

int main()
{
    // PthreadPool<Task>* pb = new PthreadPool<Task>;
    PthreadPool<Task> pb;

    //主线程生成任务或者获取任务，循环向线程池push就行
    pb.start();
    srand((unsigned long) time(0));
    const string str = "+-*/%";

    while(true)
    {
        int one = rand()%50;
        int two = rand()%10;
        char oper = str[rand()%str.size()];
        cout<<"时间："<<time(0)<< " 主线程派发计算任务: " << one << oper << two << "=?" << "\n";
        Task t(one,two,oper);
        pb.push(t);
        sleep(1);
    }
}